﻿using Common.Data.Extensions;
using CrossSelling.Core.Configuration;
using CrossSelling.Model.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CrossSelling.Core.Data.DBConfig
{
    public class PreApprovedCreditCard21Configuration : DBConfig<PreApprovedCreditCard21>
    {
        public PreApprovedCreditCard21Configuration()
            : base(SystemConfiguration.Schema, SystemConfiguration.NamingType, SystemConfiguration.TABLE_PREFIX)
        {
            HasKey(k => new { k.Dkkd, k.Rn });

            //relationship
            HasOptional(b => b.Branchs).WithMany(c => c.PreApprovedCreditCard21s).HasForeignKey(k => new { k.BranchId }).WillCascadeOnDelete(false);
            HasOptional(t => t.Customers).WithMany(o => o.PreApprovedCreditCard21s).HasForeignKey(x => new { x.Cif }).WillCascadeOnDelete(false);
        }
    }
}
